﻿{% extends "blogapp/base.html" %}
{% load static %}
{% block content %}
    <div id="main-container" class="container clearfix">
        <section class="post-left">
            <div class="row">
                <!-- 登录按钮 -->


                <!-- /banner图 -->
                <div class="col-md-6">
                    <div id="featured" class="raxus-slider" data-autoplay="3000" data-keypress="false"
                         data-thumbnail="bottom">
                        <ul class="slider-relative" id="relative">
                            {% for ban in banners %}
                                <li class="slide fix-width">
                                    <a href="{{ ban.link_url }}" title="{{ ban.text_info }}">
                                        <img src="{{ MEDIA_URL }}{{ ban.img }}" srcset="{{ MEDIA_URL }}{{ ban.img }}" alt="{{ ban.text_info }}"
                                             class="wp-post-image" width="370" height="290"/></a>
                                    <span class="text ani-left"><strong>{{ ban.text_info }}</strong></span>
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
                <!-- /banner图 -->

                <!-- 首页推荐阅读 -->
                <div class="col-md-6">
                    <div class="hotread">
                        <div class="title">推荐阅读</div>
                        {% for reco_artical in reco_articals %}
                            <div class="caption">
                                <h4><a href="{% url 'blogapp:article_detail' reco_artical.category.code reco_artical.pk %}" title="{{ reco_artical.title }}"
                                       rel="bookmark">{{ reco_artical.title }}</a></h4>
                                <p>{{ reco_artical.excerpt|truncatechars:"80" }}</p>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </div>

            <!-- 最新文章列表 -->
            <div class="index-main clearfix">
                <div class="main-title">
                    <h4 class="post-left-title fl">最新文章</h4>
                    <div class="fr"></div>
                </div>
                <div class="row">
                    {% for latest_artical in latest_articals %}
                        <div class="article-box clearfix excerpt-1">
                            <div class="col-md-4">
                                <div class="thumbnail">
                                    <a href="{% url 'blogapp:article_detail' latest_artical.category.code latest_artical.pk %}" title="{{ latest_artical.title }}" style="display: block; overflow: hidden">
                                        <img src="{{ MEDIA_URL }}{{ latest_artical.img }}"
                                             srcset="{{ MEDIA_URL }}{{ latest_artical.img }}"
                                             alt="{{ latest_artical.title }}" class="wp-post-image" width="240" height="160"/></a>
                                </div>
                            </div>
                            <div class="col-md-8">
                                <h2><a href="{% url 'blogapp:article_detail' latest_artical.category.code latest_artical.pk %}" target="_blank"
                                       title="{{ latest_artical.title }}">{{ latest_artical.title }}</a></h2>
                                <p class="txtcont hidden-xs"><a href="{% url 'blogapp:article_detail' latest_artical.category.code latest_artical.pk %}" target="_blank"
                                                                title="{{ latest_artical.title }}">{{ latest_artical.excerpt }}</a></p>
                                <div class="meta"><span class="label label-info"><a
                                        href="{% url 'blogapp:article_list' latest_artical.category.code %}">{{ latest_artical.category.name }}</a></span>
                                    <time class="item"><i class="fa fa-clock-o"></i>发布于&nbsp;{{ latest_artical.create_time|date:'Y年m月d日 H:i:s' }}
                                    </time>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            </div>
            <!-- /热门文章排行 -->
        </section>
        <!-- /post-left -->

        <!-- /post-right -->
        <aside class="post-right hidden-xs">
            <section class="widget post-right-item">
                <h4 class="post-right-title">热门文章排行榜</h4>
                <ol class="hot-list">
                    {% for hot_artical in hot_articals %}
                        <li><a href="{% url 'blogapp:article_detail' hot_artical.category.code hot_artical.pk %}" title="{{ hot_artical.title }}">{{ hot_artical.title }}</a></li>
                    {% endfor %}
                </ol>
            </section>
            {% include 'blogapp/right.html' %}
        </aside>

        <div class="FriendLink hidden-xs clearfix">
            <div class="title"><h3>友情链接：</h3></div>
            <ul class="clears">
                {% for link in links %}
                    <li><a href="{{ link.link_url }}" target="_blank">{{ link.name }}</a></li>
                {% endfor %}
            </ul>
        </div>
    </div>

{% endblock %}